<?php
/**

 //  The DoYouHaoBaby PHP FrameWork - form
 //  +---------------------------------------------------------------------
 //
 //  “Copyright”
 //  +---------------------------------------------------------------------
 //  | (C) 2010 - 2099 http://doyouhaobaby.net All rights reserved.
 //  | This is not a free software,use is subject to license terms
 //  +---------------------------------------------------------------------
 //
 //  “About This File”
 //  +---------------------------------------------------------------------
 //  | form Index控制器
 //  +---------------------------------------------------------------------

*/

!defined('DYHB_PATH') && exit;

class IndexController extends Controller{

	/**
	 * 首页 < 默认访问 >
	 *
	 * @access public
	 * @return void
	 */
	public function index(){
		// 对象
		$arrObjectList=FormModel::F()
				->top(6)
				->order('form_id DESC')
				->query();
		$this->assign('arrObjectList',$arrObjectList);

		// 数组
		$arrList=FormModel::F()
				->top(6)
				->order('form_id DESC')
				->asArray()
				->query();
		$this->assign('arrList',$arrList);
		$this->display();
	}

	/**
	 * 插入数据
	 */
	public function insert(){
		// 创建模型
		$oModel=new FormModel();
		// 保存数据
		$oModel->save();
		// 开始查找错误
		if(!$oModel->isError()){
			$this->S('数据保存成功！');
		}
		else{
			$this->E($oModel->getErrorMessage());
		}
	}

}
